package com.java.demo.model;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 小魏
 * Date: 2023-07-29
 * Time: 10:17
 */

/**
 * Users是公共类
 */
@Component
public class Users {
    /**
     * Bean对象是公共对象,默认是单例模式
     * @return
     */
    @Bean("user")
    //@Scope("prototype")
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public User getUser(){
        User user=new User();
        user.setId(1);
        user.setName("lisi");
        return user;
    }
}
